/*
在composables文件夹下的文件会自动导入
interface MetaObject {
  title?: string
  titleTemplate?: string | ((title?: string) => string)
  base?: Base
  link?: Link[]
  meta?: Meta[]
  style?: Style[]
  script?: Script[]
  noscript?: Noscript[]
  htmlAttrs?: HtmlAttributes
  bodyAttrs?: BodyAttributes
}
* */

import type { MetaObject } from "@nuxt/schema";

export const setHeadInfo = (config: MetaObject) => {
    return useHead({
        title: config.title,
        base: config.base,
        meta: config.meta,
        link: config.link,
        style: config.style,
        script: config.script,
        noscript: config.noscript,
        htmlAttrs: config.htmlAttrs,
        bodyAttrs: config.bodyAttrs,
        titleTemplate(title) {
            return title ? `官网-${config.title}` : '官网'
        },
    })
}